package org.umlviewer.model.diagram_class;

import org.umlviewer.model.Constants;
import org.jdom2.Element;
import org.jdom2.Namespace;

/**
 *
 * @author Rafa
 */
public class Param extends TypedElement{
    
    private String defaultValue;    

    public Param() {
        super();        
        defaultValue="";        
    }

    public Param(String name, String type) {
        super(type);
        setName(name);
    }

    public String getDefaultValue() {
        return defaultValue;
    }

    public void setDefaultValue(String defaultValue) {
        this.defaultValue = defaultValue;
    }

    public void xmiSerialize(Element parent) {
        Namespace xmins = Constants.XMINAMESPACE;
        Element param = new Element("ownedParameter");
        param.setAttribute("id",getId(),xmins);
        param.setAttribute("name",getName());
        param.setAttribute("type",getType());
        param.setAttribute("direction","in");
        
        parent.addContent(param);
    }
    
}
